﻿namespace WCBG.ToolsForUnity.Tools
{
    using System;
    using System.IO;

    public class FPath
    {
        public static string Combine(string path1, string path2)
        {
            if (!path1.EndsWith("/"))
            {
                path1 = path1 + "/";
            }
            if (path2.StartsWith("/"))
            {
                path2 = path2.Substring(1);
            }
            return (path1 + path2);
        }

        public static string GetDirectoryName(string path) => 
            Path.GetDirectoryName(path);

        public static string GetFileName(string file)
        {
            if (file == null)
            {
                return null;
            }
            file = file.Replace(@"\", "/");
            int num = file.LastIndexOf("/");
            if (num > 0)
            {
                return file.Substring(num + 1, (file.Length - num) - 1);
            }
            return file;
        }
    }
}

